home *** CD-ROM | disk | FTP | other *** search
- // WebHelp 5.10.001
- var garrSortChar=new Array();
- var gaFtsStop=new Array();
- var gaFtsStem=new Array();
- var gbWhLang=false;
-
- /*% OutputSortOrder.js("garrSortChar[%d] = %d;\r\n"); %*/
- /*% OutputFtsStopWords.js("gaFtsStop[%d] = \"%s\";\r\n"); %*/
- /*% OutputFtsStems.js("gaFtsStem[%d] = \"%s\";\r\n"); %*/
-
- // as javascript 1.3 support unicode instead of ISO-Latin-1
- // need to transfer come code back to ISO-Latin-1 for compare purpose
- // Note: Different Language(Code page) maybe need different array:
- var gaUToC=new Array();
- gaUToC[8364]=128;
- gaUToC[8218]=130;
- gaUToC[402]=131;
- gaUToC[8222]=132;
- gaUToC[8230]=133;
- gaUToC[8224]=134;
- gaUToC[8225]=135;
- gaUToC[710]=136;
- gaUToC[8240]=137;
- gaUToC[352]=138;
- gaUToC[8249]=139;
- gaUToC[338]=140;
- gaUToC[381]=142;
- gaUToC[8216]=145;
- gaUToC[8217]=146;
- gaUToC[8220]=147;
- gaUToC[8221]=148;
- gaUToC[8226]=149;
- gaUToC[8211]=150;
- gaUToC[8212]=151;
- gaUToC[732]=152;
- gaUToC[8482]=153;
- gaUToC[353]=154;
- gaUToC[8250]=155;
- gaUToC[339]=156;
- gaUToC[382]=158;
- gaUToC[376]=159;
-
- var gsBiggestChar="";
- function getBiggestChar()
- {
- if(gsBiggestChar.length==0)
- {
- if(garrSortChar.length<256)
- gsBiggestChar=String.fromCharCode(255);
- else
- {
- var nBiggest=0;
- var nBigChar=0;
- for(var i=0;i<=255;i++)
- {
- if(garrSortChar[i]>nBiggest)
- {
- nBiggest=garrSortChar[i];
- nBigChar=i;
- }
- }
- gsBiggestChar=String.fromCharCode(nBigChar);
- }
-
- }
- return gsBiggestChar;
- }
-
- function getCharCode(str,i)
- {
- var code=str.charCodeAt(i)
- if(code>256)
- {
- code=gaUToC[code];
- }
- return code;
- }
-
- function compare(strText1,strText2)
- {
- if(garrSortChar.length<256)
- {
- var strt1=strText1.toLowerCase();
- var strt2=strText2.toLowerCase();
- if(strt1<strt2) return -1;
- if(strt1>strt2) return 1;
- return 0;
- }
- else
- {
- for(var i=0;i<strText1.length&&i<strText2.length;i++)
- {
- if(garrSortChar[getCharCode(strText1,i)]<garrSortChar[getCharCode(strText2,i)]) return -1;
- if(garrSortChar[getCharCode(strText1,i)]>garrSortChar[getCharCode(strText2,i)]) return 1;
- }
- if(strText1.length<strText2.length) return -1;
- if(strText1.length>strText2.length) return 1;
- return 0;
- }
- }
- gbWhLang=true;